Predicting future of Solana
Source: "SOL-USD", yahoofinance.com
In [ ]:
import yfinance as yf
In [ ]:
from datetime import datetime
end = datetime.now()
start = datetime(end.year-5, end.month, end.day)
In [ ]:
stock = "SOL-USD"
sol_data = yf.download(stock, start, end)
[*********************100%%**********************] 1 of 1 completed
Data visualization and preparation¶
In [ ]:
sol_data.head
Out[ ]:
<bound method NDFrame.head of Open High Low Close Adj Close \
Date
2020-04-10 0.832005 1.313487 0.694187 0.951054 0.951054
2020-04-11 0.951054 1.049073 0.765020 0.776819 0.776819
2020-04-12 0.785448 0.956670 0.762426 0.882507 0.882507
2020-04-13 0.890760 0.891603 0.773976 0.777832 0.777832
2020-04-14 0.777832 0.796472 0.628169 0.661925 0.661925
... ... ... ... ... ...
2024-04-24 154.701309 159.580902 145.770569 147.745148 147.745148
2024-04-25 147.749619 149.303757 142.264572 144.892120 144.892120
2024-04-26 144.889175 145.854614 138.908386 139.104340 139.104340
2024-04-27 139.104340 142.874512 134.028915 141.289169 141.289169
2024-04-28 141.298676 144.477203 141.039108 142.353577 142.353577
Volume
Date
2020-04-10 87364276
2020-04-11 43862444
2020-04-12 38736897
2020-04-13 18211285
2020-04-14 16747614
... ...
2024-04-24 3932336720
2024-04-25 3674969172
2024-04-26 2564389027
2024-04-27 2373155947
2024-04-28 2122330752
[1480 rows x 6 columns]>
In [ ]:
sol_data.info()
<class 'pandas.core.frame.DataFrame'> DatetimeIndex: 1480 entries, 2020-04-10 to 2024-04-28 Data columns (total 6 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 Open 1480 non-null float64 1 High 1480 non-null float64 2 Low 1480 non-null float64 3 Close 1480 non-null float64 4 Adj Close 1480 non-null float64 5 Volume 1480 non-null int64 dtypes: float64(5), int64(1) memory usage: 80.9 KB
In [ ]:
sol_data.isna().sum()
Out[ ]:
Open 0 High 0 Low 0 Close 0 Adj Close 0 Volume 0 dtype: int64
In [ ]:
import matplotlib.pyplot as plt
%matplotlib inline
In [ ]:
def plot_graph(figsize, values, column_name):
plt.figure()
values.plot(figsize = figsize)
plt.xlabel("years")
plt.ylabel(column_name)
plt.title(f"{column_name} of Solana")
In [ ]:
for column in sol_data.columns:
plot_graph((15,5),sol_data[column], column)
In [ ]:
import pandas as pd
for i in range(2020,2025):
print(list(sol_data.index.year).count(i))
266 365 365 365 119
In [ ]:
sol_data['MA_for_100_days'] = sol_data['Adj Close'].rolling(100).mean()
In [ ]:
plot_graph((15,5), sol_data[['MA_for_100_days', 'Adj Close']], 'Moving average for 100 days')
<Figure size 640x480 with 0 Axes>
In [ ]:
adj_close = sol_data[['Adj Close']]
print("Highest recorded adj closing price: "f"{max(adj_close.values)}")
print("Lowest recorded adj closing price: "f"{min(adj_close.values)}")
Highest recorded adj closing price: [258.93432617] Lowest recorded adj closing price: [0.51527297]
In [ ]:
from sklearn.preprocessing import MinMaxScaler
scaler = MinMaxScaler(feature_range=(0,1))
scaled_data = scaler.fit_transform(adj_close)
scaled_data
Out[ ]:
array([[0.00168633],
[0.0010121 ],
[0.00142108],
...,
[0.53629585],
[0.54475045],
[0.54886937]])
In [ ]:
x_data = []
y_data = []
for i in range(100, len(scaled_data)):
x_data.append(scaled_data[i-100:i])
y_data.append(scaled_data[i])
import numpy as np
x_data, y_data = np.array(x_data), np.array(y_data)
In [ ]:
int(len(x_data)*0.7)
Out[ ]:
965
In [ ]:
1408-100-int(len(x_data)*0.8)
Out[ ]:
204
In [ ]:
split_len = int(len(x_data)*0.8)
x_train = x_data[:split_len]
y_train = y_data[:split_len]
x_test = x_data[split_len:]
y_test = y_data[split_len:]
In [ ]:
print(x_train.shape)
print(y_train.shape)
print(x_test.shape)
print(y_test.shape)
(1104, 100, 1) (1104, 1) (276, 100, 1) (276, 1)
In [ ]:
from keras.models import Sequential
from keras.layers import Dense, LSTM
In [ ]:
model = Sequential()
model.add(LSTM(128, return_sequences=True, input_shape=(x_train.shape[1],1)))
model.add(LSTM(64, return_sequences=False))
model.add(Dense(25))
model.add(Dense(1))
C:\Users\robkr\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\keras\src\layers\rnn\rnn.py:204: UserWarning: Do not pass an `input_shape`/`input_dim` argument to a layer. When using Sequential models, prefer using an `Input(shape)` object as the first layer in the model instead. super().__init__(**kwargs)
In [ ]:
model.compile(optimizer="adam", loss="mean_squared_error")
In [ ]:
model.fit(x_train, y_train, batch_size=32, epochs=16)
Epoch 1/16
35/35 ━━━━━━━━━━━━━━━━━━━━ 2s 57ms/step - loss: 6.7713e-04 Epoch 2/16 35/35 ━━━━━━━━━━━━━━━━━━━━ 2s 60ms/step - loss: 5.9745e-04 Epoch 3/16 35/35 ━━━━━━━━━━━━━━━━━━━━ 2s 60ms/step - loss: 5.2379e-04 Epoch 4/16 35/35 ━━━━━━━━━━━━━━━━━━━━ 2s 60ms/step - loss: 5.0792e-04 Epoch 5/16 35/35 ━━━━━━━━━━━━━━━━━━━━ 2s 58ms/step - loss: 5.0436e-04 Epoch 6/16 35/35 ━━━━━━━━━━━━━━━━━━━━ 2s 54ms/step - loss: 6.9417e-04 Epoch 7/16 35/35 ━━━━━━━━━━━━━━━━━━━━ 2s 54ms/step - loss: 4.4505e-04 Epoch 8/16 35/35 ━━━━━━━━━━━━━━━━━━━━ 2s 58ms/step - loss: 5.3546e-04 Epoch 9/16 35/35 ━━━━━━━━━━━━━━━━━━━━ 2s 55ms/step - loss: 4.5000e-04 Epoch 10/16 35/35 ━━━━━━━━━━━━━━━━━━━━ 2s 55ms/step - loss: 4.6141e-04 Epoch 11/16 35/35 ━━━━━━━━━━━━━━━━━━━━ 2s 53ms/step - loss: 4.0966e-04 Epoch 12/16 35/35 ━━━━━━━━━━━━━━━━━━━━ 2s 60ms/step - loss: 4.8374e-04 Epoch 13/16 35/35 ━━━━━━━━━━━━━━━━━━━━ 2s 59ms/step - loss: 4.2676e-04 Epoch 14/16 35/35 ━━━━━━━━━━━━━━━━━━━━ 2s 56ms/step - loss: 3.9546e-04 Epoch 15/16 35/35 ━━━━━━━━━━━━━━━━━━━━ 2s 59ms/step - loss: 4.5874e-04 Epoch 16/16 35/35 ━━━━━━━━━━━━━━━━━━━━ 2s 62ms/step - loss: 4.1593e-04
Out[ ]:
<keras.src.callbacks.history.History at 0x2709f5a93d0>
In [ ]:
model.summary()
Model: "sequential"
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓ ┃ Layer (type) ┃ Output Shape ┃ Param # ┃ ┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩ │ lstm (LSTM) │ (None, 100, 128) │ 66,560 │ ├─────────────────────────────────┼────────────────────────┼───────────────┤ │ lstm_1 (LSTM) │ (None, 64) │ 49,408 │ ├─────────────────────────────────┼────────────────────────┼───────────────┤ │ dense (Dense) │ (None, 25) │ 1,625 │ ├─────────────────────────────────┼────────────────────────┼───────────────┤ │ dense_1 (Dense) │ (None, 1) │ 26 │ └─────────────────────────────────┴────────────────────────┴───────────────┘
Total params: 352,859 (1.35 MB)
Trainable params: 117,619 (459.45 KB)
Non-trainable params: 0 (0.00 B)
Optimizer params: 235,240 (918.91 KB)
In [ ]:
predictions = model.predict(x_test)
9/9 ━━━━━━━━━━━━━━━━━━━━ 1s 65ms/step
In [ ]:
predictions
Out[ ]:
array([[0.10476827],
[0.1058419 ],
[0.10706996],
[0.10738068],
[0.10672432],
[0.10593645],
[0.10451553],
[0.10263409],
[0.10102185],
[0.09972688],
[0.09930767],
[0.09931739],
[0.10049287],
[0.10215778],
[0.10393409],
[0.1053826 ],
[0.10663643],
[0.10697297],
[0.10751789],
[0.10699897],
[0.10515096],
[0.10209917],
[0.09875402],
[0.09638263],
[0.09489436],
[0.09370672],
[0.09239548],
[0.09225801],
[0.09220206],
[0.09169433],
[0.09098111],
[0.09072249],
[0.09055137],
[0.09145844],
[0.09194353],
[0.09122155],
[0.08970317],
[0.08821423],
[0.08709624],
[0.08632007],
[0.08650449],
[0.08660891],
[0.08688588],
[0.08696254],
[0.08680379],
[0.08558482],
[0.08366593],
[0.08193001],
[0.08101166],
[0.08104298],
[0.08182458],
[0.08281845],
[0.08348148],
[0.08452284],
[0.08585174],
[0.08727532],
[0.08778161],
[0.08768655],
[0.08732475],
[0.08680835],
[0.08633488],
[0.08566486],
[0.08511997],
[0.08542396],
[0.08637896],
[0.08837505],
[0.09250581],
[0.09650816],
[0.09979904],
[0.1017207 ],
[0.10217411],
[0.10237686],
[0.10226671],
[0.10197027],
[0.1006995 ],
[0.09919089],
[0.09778775],
[0.09614743],
[0.09517408],
[0.09488852],
[0.09495053],
[0.09688757],
[0.09936677],
[0.1011987 ],
[0.1035864 ],
[0.10749393],
[0.11331818],
[0.11860675],
[0.12490653],
[0.12893008],
[0.1329258 ],
[0.13627863],
[0.13768624],
[0.13773188],
[0.13805366],
[0.14023885],
[0.14593102],
[0.15472884],
[0.16215332],
[0.16675782],
[0.1714537 ],
[0.17414169],
[0.17601994],
[0.17788766],
[0.17938796],
[0.1823579 ],
[0.19537601],
[0.21000563],
[0.22236653],
[0.22696911],
[0.23128034],
[0.24232405],
[0.2468098 ],
[0.24771184],
[0.24665618],
[0.2474871 ],
[0.24442327],
[0.2361004 ],
[0.232334 ],
[0.23058894],
[0.23055743],
[0.23327516],
[0.23567231],
[0.23509803],
[0.23616536],
[0.23869032],
[0.24132378],
[0.24392705],
[0.24964334],
[0.25473434],
[0.25693795],
[0.25671753],
[0.25615537],
[0.26103488],
[0.2740999 ],
[0.28544638],
[0.29581508],
[0.29900143],
[0.29624727],
[0.2933429 ],
[0.29552817],
[0.2963382 ],
[0.29748344],
[0.29613316],
[0.2972291 ],
[0.2978696 ],
[0.30715752],
[0.32981634],
[0.35773522],
[0.39143166],
[0.42458454],
[0.45814666],
[0.47358677],
[0.47019666],
[0.45325315],
[0.43853274],
[0.42336607],
[0.4116401 ],
[0.41296706],
[0.41708955],
[0.41369486],
[0.4150599 ],
[0.41296798],
[0.40379807],
[0.3892104 ],
[0.38453642],
[0.38698462],
[0.39495343],
[0.40141582],
[0.39722317],
[0.3934179 ],
[0.38875538],
[0.38511992],
[0.38596106],
[0.39312688],
[0.39331985],
[0.38959578],
[0.38407576],
[0.3772635 ],
[0.36421132],
[0.35233396],
[0.34829667],
[0.3470223 ],
[0.353166 ],
[0.3631229 ],
[0.3744268 ],
[0.38944408],
[0.40227592],
[0.40618017],
[0.4057016 ],
[0.40566444],
[0.402852 ],
[0.39690626],
[0.39105034],
[0.38800347],
[0.3912714 ],
[0.39857632],
[0.41043383],
[0.42383808],
[0.43291706],
[0.4424901 ],
[0.45021015],
[0.45963883],
[0.4635934 ],
[0.46045774],
[0.45322785],
[0.4492541 ],
[0.44685888],
[0.4426674 ],
[0.4354102 ],
[0.42518324],
[0.41461012],
[0.41103837],
[0.4108925 ],
[0.41937542],
[0.42816067],
[0.4453578 ],
[0.47015712],
[0.49663317],
[0.51642483],
[0.52840394],
[0.53610647],
[0.5307497 ],
[0.52631503],
[0.53765684],
[0.55398065],
[0.5675867 ],
[0.57630473],
[0.58527493],
[0.5942504 ],
[0.6154668 ],
[0.6509109 ],
[0.68994695],
[0.71789694],
[0.75715685],
[0.7808774 ],
[0.75830823],
[0.749078 ],
[0.7311405 ],
[0.7092566 ],
[0.6906959 ],
[0.6923237 ],
[0.7091341 ],
[0.7303865 ],
[0.7427615 ],
[0.7521899 ],
[0.76051056],
[0.76813394],
[0.78325 ],
[0.783451 ],
[0.7631563 ],
[0.7452488 ],
[0.7314327 ],
[0.7119226 ],
[0.7017824 ],
[0.6996232 ],
[0.7034052 ],
[0.6989869 ],
[0.69430393],
[0.68987805],
[0.6642397 ],
[0.6209989 ],
[0.59686273],
[0.5724062 ],
[0.55299467],
[0.5366241 ],
[0.5380734 ],
[0.54785544],
[0.56888616],
[0.5864321 ],
[0.6074815 ],
[0.62094057],
[0.61872274],
[0.60642135],
[0.585794 ],
[0.5694302 ]], dtype=float32)
In [ ]:
inv_predictions = scaler.inverse_transform(predictions)
inv_predictions
Out[ ]:
array([[ 27.58939 ],
[ 27.866837],
[ 28.184193],
[ 28.264488],
[ 28.094872],
[ 27.891272],
[ 27.524078],
[ 27.037878],
[ 26.621244],
[ 26.2866 ],
[ 26.178268],
[ 26.180779],
[ 26.484547],
[ 26.914791],
[ 27.373823],
[ 27.748146],
[ 28.072159],
[ 28.159128],
[ 28.299946],
[ 28.165846],
[ 27.688286],
[ 26.899645],
[ 26.035194],
[ 25.422382],
[ 25.037786],
[ 24.730875],
[ 24.392025],
[ 24.3565 ],
[ 24.342043],
[ 24.210836],
[ 24.026525],
[ 23.959694],
[ 23.915472],
[ 24.149878],
[ 24.275234],
[ 24.08866 ],
[ 23.696283],
[ 23.311512],
[ 23.0226 ],
[ 22.822025],
[ 22.869682],
[ 22.896666],
[ 22.968243],
[ 22.988052],
[ 22.947025],
[ 22.63202 ],
[ 22.136145],
[ 21.68755 ],
[ 21.45023 ],
[ 21.458324],
[ 21.660303],
[ 21.91714 ],
[ 22.088478],
[ 22.357586],
[ 22.701 ],
[ 23.068878],
[ 23.199715],
[ 23.175148],
[ 23.081652],
[ 22.948204],
[ 22.825853],
[ 22.652706],
[ 22.511896],
[ 22.590452],
[ 22.837244],
[ 23.35307 ],
[ 24.420536],
[ 25.45482 ],
[ 26.305246],
[ 26.80184 ],
[ 26.91901 ],
[ 26.971405],
[ 26.94294 ],
[ 26.866335],
[ 26.537943],
[ 26.14809 ],
[ 25.78549 ],
[ 25.361603],
[ 25.11007 ],
[ 25.036276],
[ 25.0523 ],
[ 25.552868],
[ 26.19354 ],
[ 26.666945],
[ 27.283972],
[ 28.293753],
[ 29.798851],
[ 31.165518],
[ 32.7935 ],
[ 33.83326 ],
[ 34.86583 ],
[ 35.732265],
[ 36.09602 ],
[ 36.107815],
[ 36.190968],
[ 36.755665],
[ 38.226627],
[ 40.500153],
[ 42.418777],
[ 43.60867 ],
[ 44.822174],
[ 45.516804],
[ 46.00218 ],
[ 46.484833],
[ 46.87254 ],
[ 47.64003 ],
[ 51.004154],
[ 54.784725],
[ 57.97902 ],
[ 59.168415],
[ 60.28252 ],
[ 63.136425],
[ 64.29562 ],
[ 64.52873 ],
[ 64.25593 ],
[ 64.47065 ],
[ 63.6789 ],
[ 61.528114],
[ 60.554806],
[ 60.103848],
[ 60.095703],
[ 60.79802 ],
[ 61.41749 ],
[ 61.269085],
[ 61.5449 ],
[ 62.1974 ],
[ 62.877937],
[ 63.550667],
[ 65.02787 ],
[ 66.34348 ],
[ 66.91294 ],
[ 66.85598 ],
[ 66.7107 ],
[ 67.971664],
[ 71.34791 ],
[ 74.28006 ],
[ 76.959526],
[ 77.78294 ],
[ 77.07121 ],
[ 76.32066 ],
[ 76.88538 ],
[ 77.09471 ],
[ 77.39066 ],
[ 77.041725],
[ 77.32494 ],
[ 77.490456],
[ 79.89063 ],
[ 85.7461 ],
[ 92.96087 ],
[101.66868 ],
[110.23601 ],
[118.9091 ],
[122.89912 ],
[122.023056],
[117.64452 ],
[113.84049 ],
[109.921135],
[106.89092 ],
[107.23383 ],
[108.299164],
[107.42191 ],
[107.77466 ],
[107.23407 ],
[104.864395],
[101.09466 ],
[ 99.88681 ],
[100.51947 ],
[102.578766],
[104.24877 ],
[103.16531 ],
[102.18195 ],
[100.97707 ],
[100.0376 ],
[100.25497 ],
[102.10675 ],
[102.15662 ],
[101.194244],
[ 99.76777 ],
[ 98.00735 ],
[ 94.63442 ],
[ 91.56509 ],
[ 90.521774],
[ 90.19245 ],
[ 91.780106],
[ 94.35316 ],
[ 97.2743 ],
[101.155045],
[104.47104 ],
[105.47997 ],
[105.3563 ],
[105.346695],
[104.61991 ],
[103.08341 ],
[101.57014 ],
[100.78277 ],
[101.627266],
[103.51499 ],
[106.5792 ],
[110.04311 ],
[112.38929 ],
[114.86315 ],
[116.858154],
[119.29471 ],
[120.31664 ],
[119.50633 ],
[117.637985],
[116.61109 ],
[115.99213 ],
[114.908966],
[113.03357 ],
[110.390724],
[107.65843 ],
[106.73542 ],
[106.69772 ],
[108.88988 ],
[111.16015 ],
[115.60422 ],
[122.01283 ],
[128.85475 ],
[133.9693 ],
[137.06493 ],
[139.0554 ],
[137.67111 ],
[136.52512 ],
[139.45605 ],
[143.67442 ],
[147.1905 ],
[149.4434 ],
[151.76147 ],
[154.0809 ],
[159.56361 ],
[168.72305 ],
[178.81071 ],
[186.03352 ],
[196.17903 ],
[202.30888 ],
[196.47658 ],
[194.0913 ],
[189.45592 ],
[183.80069 ],
[179.00426 ],
[179.42491 ],
[183.76904 ],
[189.26106 ],
[192.459 ],
[194.89548 ],
[197.0457 ],
[199.01572 ],
[202.922 ],
[202.97395 ],
[197.7294 ],
[193.10176 ],
[189.53142 ],
[184.48964 ],
[181.86922 ],
[181.31125 ],
[182.28859 ],
[181.1468 ],
[179.93665 ],
[178.79291 ],
[172.16747 ],
[160.99323 ],
[154.75598 ],
[148.43594 ],
[143.41963 ],
[139.18916 ],
[139.5637 ],
[142.09155 ],
[147.5263 ],
[152.0605 ],
[157.50006 ],
[160.97815 ],
[160.40501 ],
[157.2261 ],
[151.8956 ],
[147.66689 ]], dtype=float32)
In [ ]:
inv_y_test = scaler.inverse_transform(predictions)
inv_y_test
Out[ ]:
array([[ 27.58939 ],
[ 27.866837],
[ 28.184193],
[ 28.264488],
[ 28.094872],
[ 27.891272],
[ 27.524078],
[ 27.037878],
[ 26.621244],
[ 26.2866 ],
[ 26.178268],
[ 26.180779],
[ 26.484547],
[ 26.914791],
[ 27.373823],
[ 27.748146],
[ 28.072159],
[ 28.159128],
[ 28.299946],
[ 28.165846],
[ 27.688286],
[ 26.899645],
[ 26.035194],
[ 25.422382],
[ 25.037786],
[ 24.730875],
[ 24.392025],
[ 24.3565 ],
[ 24.342043],
[ 24.210836],
[ 24.026525],
[ 23.959694],
[ 23.915472],
[ 24.149878],
[ 24.275234],
[ 24.08866 ],
[ 23.696283],
[ 23.311512],
[ 23.0226 ],
[ 22.822025],
[ 22.869682],
[ 22.896666],
[ 22.968243],
[ 22.988052],
[ 22.947025],
[ 22.63202 ],
[ 22.136145],
[ 21.68755 ],
[ 21.45023 ],
[ 21.458324],
[ 21.660303],
[ 21.91714 ],
[ 22.088478],
[ 22.357586],
[ 22.701 ],
[ 23.068878],
[ 23.199715],
[ 23.175148],
[ 23.081652],
[ 22.948204],
[ 22.825853],
[ 22.652706],
[ 22.511896],
[ 22.590452],
[ 22.837244],
[ 23.35307 ],
[ 24.420536],
[ 25.45482 ],
[ 26.305246],
[ 26.80184 ],
[ 26.91901 ],
[ 26.971405],
[ 26.94294 ],
[ 26.866335],
[ 26.537943],
[ 26.14809 ],
[ 25.78549 ],
[ 25.361603],
[ 25.11007 ],
[ 25.036276],
[ 25.0523 ],
[ 25.552868],
[ 26.19354 ],
[ 26.666945],
[ 27.283972],
[ 28.293753],
[ 29.798851],
[ 31.165518],
[ 32.7935 ],
[ 33.83326 ],
[ 34.86583 ],
[ 35.732265],
[ 36.09602 ],
[ 36.107815],
[ 36.190968],
[ 36.755665],
[ 38.226627],
[ 40.500153],
[ 42.418777],
[ 43.60867 ],
[ 44.822174],
[ 45.516804],
[ 46.00218 ],
[ 46.484833],
[ 46.87254 ],
[ 47.64003 ],
[ 51.004154],
[ 54.784725],
[ 57.97902 ],
[ 59.168415],
[ 60.28252 ],
[ 63.136425],
[ 64.29562 ],
[ 64.52873 ],
[ 64.25593 ],
[ 64.47065 ],
[ 63.6789 ],
[ 61.528114],
[ 60.554806],
[ 60.103848],
[ 60.095703],
[ 60.79802 ],
[ 61.41749 ],
[ 61.269085],
[ 61.5449 ],
[ 62.1974 ],
[ 62.877937],
[ 63.550667],
[ 65.02787 ],
[ 66.34348 ],
[ 66.91294 ],
[ 66.85598 ],
[ 66.7107 ],
[ 67.971664],
[ 71.34791 ],
[ 74.28006 ],
[ 76.959526],
[ 77.78294 ],
[ 77.07121 ],
[ 76.32066 ],
[ 76.88538 ],
[ 77.09471 ],
[ 77.39066 ],
[ 77.041725],
[ 77.32494 ],
[ 77.490456],
[ 79.89063 ],
[ 85.7461 ],
[ 92.96087 ],
[101.66868 ],
[110.23601 ],
[118.9091 ],
[122.89912 ],
[122.023056],
[117.64452 ],
[113.84049 ],
[109.921135],
[106.89092 ],
[107.23383 ],
[108.299164],
[107.42191 ],
[107.77466 ],
[107.23407 ],
[104.864395],
[101.09466 ],
[ 99.88681 ],
[100.51947 ],
[102.578766],
[104.24877 ],
[103.16531 ],
[102.18195 ],
[100.97707 ],
[100.0376 ],
[100.25497 ],
[102.10675 ],
[102.15662 ],
[101.194244],
[ 99.76777 ],
[ 98.00735 ],
[ 94.63442 ],
[ 91.56509 ],
[ 90.521774],
[ 90.19245 ],
[ 91.780106],
[ 94.35316 ],
[ 97.2743 ],
[101.155045],
[104.47104 ],
[105.47997 ],
[105.3563 ],
[105.346695],
[104.61991 ],
[103.08341 ],
[101.57014 ],
[100.78277 ],
[101.627266],
[103.51499 ],
[106.5792 ],
[110.04311 ],
[112.38929 ],
[114.86315 ],
[116.858154],
[119.29471 ],
[120.31664 ],
[119.50633 ],
[117.637985],
[116.61109 ],
[115.99213 ],
[114.908966],
[113.03357 ],
[110.390724],
[107.65843 ],
[106.73542 ],
[106.69772 ],
[108.88988 ],
[111.16015 ],
[115.60422 ],
[122.01283 ],
[128.85475 ],
[133.9693 ],
[137.06493 ],
[139.0554 ],
[137.67111 ],
[136.52512 ],
[139.45605 ],
[143.67442 ],
[147.1905 ],
[149.4434 ],
[151.76147 ],
[154.0809 ],
[159.56361 ],
[168.72305 ],
[178.81071 ],
[186.03352 ],
[196.17903 ],
[202.30888 ],
[196.47658 ],
[194.0913 ],
[189.45592 ],
[183.80069 ],
[179.00426 ],
[179.42491 ],
[183.76904 ],
[189.26106 ],
[192.459 ],
[194.89548 ],
[197.0457 ],
[199.01572 ],
[202.922 ],
[202.97395 ],
[197.7294 ],
[193.10176 ],
[189.53142 ],
[184.48964 ],
[181.86922 ],
[181.31125 ],
[182.28859 ],
[181.1468 ],
[179.93665 ],
[178.79291 ],
[172.16747 ],
[160.99323 ],
[154.75598 ],
[148.43594 ],
[143.41963 ],
[139.18916 ],
[139.5637 ],
[142.09155 ],
[147.5263 ],
[152.0605 ],
[157.50006 ],
[160.97815 ],
[160.40501 ],
[157.2261 ],
[151.8956 ],
[147.66689 ]], dtype=float32)
In [ ]:
rmse = np.sqrt(np.mean((inv_predictions - inv_y_test)**2))
In [ ]:
rmse
Out[ ]:
0.0
In [ ]:
plotting_data = pd.DataFrame({
'original_test_data': inv_y_test.reshape(-1),
'predictions': inv_predictions.reshape(-1)
}, index=sol_data.index[split_len+100:])
In [ ]:
plot_graph((15,5), plotting_data, 'Prediction data')
<Figure size 640x480 with 0 Axes>
In [ ]:
plot_graph((15,5), pd.concat([adj_close[:split_len+200], plotting_data], axis=0), 'Entire data')
<Figure size 640x480 with 0 Axes>
In [ ]:
model.save("solana_predictive_model.keras")